﻿
//部门下拉框
$.ajax({
    type: "post",
    url: "/Notic_tail/DepartInfo",
    success: function (departinfos) {
        if (departinfos != null) {
            //循环追加部门名称
            for (var i = 0; i < departinfos.length; i++) {
                $("#part").append('<option id=' + departinfos[i].DepartId + '>' + departinfos[i].DepartName + '</option>');
            }
        }
    }
})
//获取所有信息做添加通知操作

//点击保存按键进去通知发布

$(".btn").click(function () {
    var tit = $("#tit").val();//获取标题信息
    var no = $("#no").val();//获取编号信息
    var person = $("#person").val();//获取发布人信息
    var demo = $("#demo").val();//获取发布时间信息
    var part = $("#part").val();//获取发布部门信息
    var editor = $("#editor").val();//获取发布内容信息
    alert(part);
    //对单人通知
    var Announcement = {};//创建通知对象
    Announcement.Ann_Number = no;//编号
    Announcement.Ann_Title = tit;//标题
    Announcement.Ann_Content = editor;//内容
    Announcement.CreateTime = demo;//发布时间
    Announcement.Department = part;//部门
    Announcement.Publisher = person;//发布人
    $.ajax({
        type: "post",
        data: Announcement,
        url: "/Announcement/AnnouncementByOne",
        success: function (operate) {
            if (operate.Success) {
                layer.msg('通知修改成功!', { icon: 6, time: 1000 });
                window.location.href = "/Home/Notice";
            } else {
                layer.msg('通知修改失败!', { icon: 6, time: 1000 });

            }
        }
    })
});
